<template>
  <a-form-model
    :ref="'lifestyleForm' + confirmType"
    :model="lifestyle"
    :label-col="formItemLayout.labelCol"
    :wrapper-col="formItemLayout.wrapperCol"
    labelAlign="left"
  >
    <a-form-model-item label="1.爱吃及吃得多的食物">
      <j-multi-select-tag v-model="lifestyle.likeEat" :options="foodList" type="checkbox"> </j-multi-select-tag>
    </a-form-model-item>
    <a-form-model-item label="2.爱喝及喝得多的饮料">
      <j-multi-select-tag v-model="lifestyle.likeDrink" :options="drinkList" type="checkbox"> </j-multi-select-tag>
    </a-form-model-item>
    <a-form-model-item label="3.是否喜欢吃零食">
      <a-radio-group v-model="lifestyle.likeSnacks">
        <a-radio :value="1"> 是 </a-radio>
        <a-radio :value="2"> 否 </a-radio>
      </a-radio-group>
    </a-form-model-item>
    <a-form-model-item label="4.每日坚持吃早餐吗">
      <a-radio-group v-model="lifestyle.stillBreakfast">
        <a-radio :value="1"> 是 </a-radio>
        <a-radio :value="2"> 有时吃有时不吃 </a-radio>
        <a-radio :value="3"> 经常不吃 </a-radio>
        <a-radio :value="4"> 不吃 </a-radio>
      </a-radio-group>
    </a-form-model-item>
    <a-form-model-item label="5.三餐中哪一餐吃的最多">
      <a-radio-group v-model="lifestyle.whichMore">
        <a-radio :value="1"> 早餐 </a-radio>
        <a-radio :value="2"> 中餐 </a-radio>
        <a-radio :value="3"> 晚餐 </a-radio>
      </a-radio-group>
    </a-form-model-item>
    <a-form-model-item label="6.每顿饭是否吃的很饱">
      <a-radio-group v-model="lifestyle.eatSatisfied">
        <a-radio :value="1"> 非常饱 </a-radio>
        <a-radio :value="2"> 七八分饱 </a-radio>
        <a-radio :value="3"> 饭后常常有饥饿感 </a-radio>
      </a-radio-group>
    </a-form-model-item>
    <a-form-model-item label="7.是否喜欢吃宵夜">
      <a-radio-group v-model="lifestyle.likeMidnightfood">
        <a-radio :value="1"> 经常 </a-radio>
        <a-radio :value="2"> 偶尔 </a-radio>
        <a-radio :value="3"> 从不 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :wrapper-col="{ span: 5 }" label="8.您的主食结构是">
      <a-radio-group v-model="lifestyle.stapleFoodStructure">
        <a-radio :value="1"> 大米白面为主，少量粗粮薯类 </a-radio>
        <a-radio :value="2"> 大米白面、粗粮、薯类三者基本等量 </a-radio>
        <a-radio :value="3"> 粗粮为主，少量大米白面 </a-radio>
        <a-radio :value="4"> 只吃大米白面，基本不吃粗粮 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="9.您每餐摄入主食的情况如何？"> </a-form-model-item>

    <a-form-model-item :wrapper-col="{ span: 10 }" label="早餐">
      <a-radio-group v-model="lifestyle.eatStapleBreakfast">
        <a-radio :value="1"> 一般不吃主食 </a-radio>
        <a-radio :value="2">
          吃主食，请描述种类和分量(如：3-4片面包切片)<a-input
            v-model="lifestyle.eatStapleBreakfastDetail"
            style="width:200px;margin-left:10px"
            :max-length="15"
            placeholder="限制15字符以内"
          />
        </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :wrapper-col="{ span: 10 }" label="午餐">
      <a-radio-group v-model="lifestyle.eatStapleLunch">
        <a-radio :value="1"> 一般不吃主食 </a-radio>
        <a-radio :value="2">
          吃主食，请描述种类和分量(如：3-4片面包切片)<a-input
            v-model="lifestyle.eatStapleLunchDetail"
            style="width:200px;margin-left:10px"
            :max-length="15"
            placeholder="限制15字符以内"
          />
        </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :wrapper-col="{ span: 10 }" label="晚餐">
      <a-radio-group v-model="lifestyle.eatStapleDinner">
        <a-radio :value="1"> 一般不吃主食 </a-radio>
        <a-radio :value="2">
          吃主食，请描述种类和分量(如：3-4片面包切片)<a-input
            v-model="lifestyle.eatStapleDinnerDetail"
            style="width:200px;margin-left:10px"
            :max-length="15"
            placeholder="限制15字符以内"
          />
        </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="10.您吃粗粮食品（红薯、玉米、小米、黑米、燕麦等）的天数">
      <a-radio-group v-model="lifestyle.eatCoarseGrainFood">
        <a-radio :value="1"> 每天吃 </a-radio>
        <a-radio :value="2"> 每周有4-6天 </a-radio>
        <a-radio :value="3"> 每周有1-3天 </a-radio>
        <a-radio :value="4"> 基本不吃 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="11.您每天新鲜蔬菜的食用量是多少">
      <a-radio-group v-model="lifestyle.eatVegetables">
        <a-radio :value="1"> 约 1斤或1斤以上 </a-radio>
        <a-radio :value="2"> 约半斤到一斤 </a-radio>
        <a-radio :value="3"> 不足半斤 </a-radio>
        <a-radio :value="4"> 基本不吃 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="12.您食用新鲜水果的习惯是">
      <a-radio-group v-model="lifestyle.eatFruits">
        <a-radio :value="1"> 几乎不吃水果 </a-radio>
        <a-radio :value="2"> 每周约1-3天 </a-radio>
        <a-radio :value="3"> 每周约4-6天 </a-radio>
        <a-radio :value="4"> 几乎每天 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item
      :label-col="{ span: 16 }"
      label="13.您每日食用肉类食物(包括猪、牛、羊、禽肉、鱼、虾及动物内脏类等) 约多少? （成人掌心大小及厚度的畜禽肉约50-75克）"
    >
      <a-radio-group v-model="lifestyle.eatMeat">
        <a-radio :value="1"> 约1个掌心以上 </a-radio>
        <a-radio :value="2"> 约1个掌心 </a-radio>
        <a-radio :value="3"> 约半个掌心 </a-radio>
        <a-radio :value="4"> 约半个手掌心以下 </a-radio>
        <a-radio :value="5"> 基本不吃 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item
      :label-col="{ span: 10 }"
      v-if="lifestyle.eatMeat != 5"
      label="14.您现在摄入肉类食物的主要种类是"
    >
      <a-radio-group v-model="lifestyle.eatMeatType">
        <a-radio :value="1"> 猪牛羊肉 </a-radio>
        <a-radio :value="2"> 鸡鸭肉 </a-radio>
        <a-radio :value="3"> 鱼虾肉 </a-radio>
        <a-radio :value="4"> 各种都吃 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="15.您每周摄入奶或奶制品的次数是多少">
      <a-radio-group v-model="lifestyle.eatMilk">
        <a-radio :value="1"> 1-3次 </a-radio>
        <a-radio :value="2"> 4-6次 </a-radio>
        <a-radio :value="3"> ≥7次 </a-radio>
        <a-radio :value="4"> 基本不喝 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="16.您每周摄入蛋类的次数是多少">
      <a-radio-group v-model="lifestyle.eatEggs">
        <a-radio :value="1"> 1-3次 </a-radio>
        <a-radio :value="2"> 4-6次 </a-radio>
        <a-radio :value="3"> ≥7次 </a-radio>
        <a-radio :value="4"> 基本不吃 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="17.您每周摄入坚果（如核桃、腰果、杏仁等）的次数是多少">
      <a-radio-group v-model="lifestyle.eatNut">
        <a-radio :value="1"> 1-3次 </a-radio>
        <a-radio :value="2"> 4-6次 </a-radio>
        <a-radio :value="3"> ≥7次 </a-radio>
        <a-radio :value="4"> 基本不吃 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="18.您是否有固定加餐习惯">
      <a-radio-group v-model="lifestyle.eatingHabits">
        <a-radio :value="1"> 无 </a-radio>
        <a-radio :value="2">
          有，一般加餐时间
          <a-select style="width:150px;margin-right:10px;margin-left:10px" v-model="lifestyle.eatingHabitsTimes">
            <a-select-option :value="1">9:00-11:00</a-select-option>
            <a-select-option :value="2">14:00-16:00</a-select-option>
            <a-select-option :value="3">16:00-17:00</a-select-option>
            <a-select-option :value="4">20:00-22:00</a-select-option>
          </a-select>
          加餐食物
          <a-input
            v-model="lifestyle.eatingHabitsFood"
            style="width:200px;margin-left:10px"
            :max-length="15"
            placeholder="限制15字符以内"
          />
        </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="19.您的口味相对周围的人是否偏油">
      <a-radio-group v-model="lifestyle.isOil">
        <a-radio :value="1"> 否 </a-radio>
        <a-radio :value="2"> 是 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="20.您的口味相对周围的人是否偏咸">
      <a-radio-group v-model="lifestyle.isSalty">
        <a-radio :value="1"> 否 </a-radio>
        <a-radio :value="2"> 是 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 4 }" :wrapper-col="{ span: 10 }" label="21.您常食用的烹调用油为">
      <j-multi-select-tag v-model="lifestyle.cookingOil" :options="oilList" type="checkbox" @change="handleChange">
      </j-multi-select-tag>
      <a-input
        style="width:200px;margin-left:10px"
        v-if="lifestyle.cookingOil && lifestyle.cookingOil.indexOf(9) != -1"
        v-model="lifestyle.cookingOilOthers"
        :max-length="5"
        placeholder="限制5字符以内"
      />
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="22.您一般每周摄入如沙琪玛/冰淇淋/饼干/果脯/饮料等零食的频率是">
      <a-radio-group v-model="lifestyle.eatSnacks">
        <a-radio :value="1"> 从不吃 </a-radio>
        <a-radio :value="2"> ＜2次 </a-radio>
        <a-radio :value="3"> 2-4次 </a-radio>
        <a-radio :value="4"> ＞4次 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="23.您每日的饮水种类、饮水习惯和饮水量"> </a-form-model-item>

    <a-form-model-item label="饮水种类">
      <a-radio-group v-model="lifestyle.drinkingWaterType">
        <a-radio :value="1"> 白开水 </a-radio>
        <a-radio :value="2"> 茶水 </a-radio>
        <a-radio :value="3"> 矿泉水 </a-radio>
        <a-radio :value="4"> 纯净水 </a-radio>
        <a-radio :value="5"> 其它 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item label="饮水习惯">
      <a-radio-group v-model="lifestyle.drinkingWaterHabits">
        <a-radio :value="1"> 晨起空腹喝一杯温白开水 </a-radio>
        <a-radio :value="2"> 晨起空腹喝一杯蜂蜜水 </a-radio>
        <a-radio :value="3"> 晨起空腹喝一杯淡盐水 </a-radio>
        <a-radio :value="4"> 一整天很少主动喝水 </a-radio>
        <a-radio :value="5"> 会主动不定时喝水 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item label="饮水量">
      <a-radio-group v-model="lifestyle.drinkingWaterAmount">
        <a-radio :value="1"> ＜6杯 </a-radio>
        <a-radio :value="2"> 6-8杯 </a-radio>
        <a-radio :value="3"> ＞8杯（以家用纸杯200ml一杯为参考） </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item
      :label-col="{ span: 16 }"
      label="24.您平均每日饮用多少罐饮料?(饮料包括茶饮料、碳酸饮料、运动饮料等)"
    >
      <a-radio-group v-model="lifestyle.drinksCans">
        <a-radio :value="1"> ≤1罐 </a-radio>
        <a-radio :value="2"> >1罐 </a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 8 }" label="25.您正在服用的营养保健品、滋补药材、茶饮有哪些">
    </a-form-model-item>

    <a-form-model-item label="营养保健品类">
      <a-radio-group v-model="lifestyle.healthProducts">
        <a-radio :value="1"> 无 </a-radio>
        <a-radio :value="2">
          有，具体名称是
          <a-input
            v-model="lifestyle.healthProductsDetail"
            style="width:200px;margin-left:10px"
            :max-length="15"
            placeholder="限制15字符以内"
        /></a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item label="滋补药材">
      <a-radio-group v-model="lifestyle.tonicHerbs">
        <a-radio :value="1"> 无 </a-radio>
        <a-radio :value="2">
          有，具体名称是
          <a-input
            v-model="lifestyle.tonicHerbsDetail"
            style="width:200px;margin-left:10px"
            :max-length="15"
            placeholder="限制15字符以内"
        /></a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item label="茶饮">
      <a-radio-group v-model="lifestyle.teaDrinks">
        <a-radio :value="1"> 无 </a-radio>
        <a-radio :value="2">
          有，具体名称是
          <a-input
            v-model="lifestyle.teaDrinksDetail"
            style="width:200px;margin-left:10px"
            :max-length="15"
            placeholder="限制15字符以内"
        /></a-radio>
      </a-radio-group>
    </a-form-model-item>

    <a-form-model-item :label-col="{ span: 10 }" label="26.您平时三餐的食物种类和摄入量"> </a-form-model-item>

    <a-form-model-item label="早餐">
      <a-input v-model="lifestyle.eatBreakfast" :max-length="30" placeholder="限制30字符以内" />
    </a-form-model-item>

    <a-form-model-item label="午餐">
      <a-input v-model="lifestyle.eatLunch" :max-length="30" placeholder="限制30字符以内" />
    </a-form-model-item>

    <a-form-model-item label="晚餐">
      <a-input v-model="lifestyle.eatDinner" :max-length="30" placeholder="限制30字符以内" />
    </a-form-model-item>

    <a-form-model-item label="加餐">
      <a-input v-model="lifestyle.eatExtraMeal" :max-length="30" placeholder="限制30字符以内" />
    </a-form-model-item>

    <a-form-model-item label="饮食习惯评分">
      <a-rate v-model="lifestyle.eatingHabitsScore"></a-rate>
      <span v-if="lifestyle.eatingHabitsScore" class="ant-rate-text">{{ lifestyle.eatingHabitsScore }}分</span>
    </a-form-model-item>
    <a-form-model-item label="小结">
      <a-textarea
        v-model="lifestyle.eatingHabitsComment"
        :maxLength="100"
        :rows="4"
        placeholder="请输入100字以内的小结"
      />
      <div>
        <a :style="{ display: 'inline-block', float: 'right', color: 'red' }" @click="handleTemplateSave">
          保存到模版
        </a>
        <a
          :style="{ display: 'inline-block', float: 'right', marginRight: '20px', color: 'red' }"
          @click="handleTemplate"
        >
          从模版选择
        </a>
      </div>
    </a-form-model-item>
    <a-modal
      :visible="saveVisit"
      title="保存到模版"
      ref="saveVisit"
      width="500px"
      @ok="handleOk"
      @cancel="handleCancel"
      :confirm-loading="typeConfirmLoading"
    >
      <a-form-model ref="editform" :model="category" :rules="validatorRules">
        <a-form-model-item label="分类名称" :labelCol="{ span: 4 }" :wrapperCol="{ span: 8 }" prop="categoryType">
          <a-select placeholder="请选择分类" v-model="category.categoryType">
            <a-select-option v-for="item in list" :key="item.dataId" :value="item.dataId">{{
              item.categoryName
            }}</a-select-option>
          </a-select>
        </a-form-model-item>
      </a-form-model>
    </a-modal>
    <advise-template ref="modalForm" @ok="modalFormOk"></advise-template>

    <a-form-model-item :wrapper-col="{ span: 12, offset: 10 }">
      <a-button type="primary" @click="save" :loading="saveLoading">保存</a-button>
      <a-popconfirm placement="topLeft" ok-text="是" cancel-text="否" @confirm="confirm">
        <template slot="title">
          <p>此操作代表你已完成了页面的填写，是否继续？</p>
        </template>
        <a-button type="primary" style="margin-left: 30px" :loading="saveLoading">确认完成</a-button>
      </a-popconfirm>
    </a-form-model-item>
  </a-form-model>
</template>

<script>
import { postAction } from '@/api/manage'
import { mapGetters } from 'vuex'
import AdviseTemplate from '../../bloodProfile/modules/AdviseTemplate'
export default {
  name: 'Diet',
  props: ['lifestyle', 'list'],
  components: { AdviseTemplate },
  data() {
    return {
      confirmType: 1,
      rate: 0,
      saveVisit: false,
      category: {},
      typeConfirmLoading: false,
      validatorRules: {
        categoryType: [{ required: true, message: '请选择分类' }]
      },
      formItemLayout: {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 3 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        }
      },
      tailFormItemLayout: {
        wrapperCol: {
          xs: {
            span: 24,
            offset: 0
          },
          sm: {
            span: 16,
            offset: 2
          }
        }
      },
      saveLoading: false,
      foodList: [
        {
          label: '油炸食品',
          value: '1'
        },
        {
          label: '甜点',
          value: '2'
        },
        {
          label: '干果',
          value: '3'
        },
        {
          label: '蔬菜',
          value: '4'
        }
      ],
      drinkList: [
        {
          label: '甜牛奶',
          value: '1'
        },
        {
          label: '淡牛奶',
          value: '2'
        },
        {
          label: '甜豆浆',
          value: '3'
        },
        {
          label: '淡豆浆',
          value: '4'
        },
        {
          label: '甜奶茶',
          value: '5'
        },
        {
          label: '茶',
          value: '6'
        },
        {
          label: '开水',
          value: '7'
        },
        {
          label: '甜咖啡',
          value: '8'
        },
        {
          label: '淡咖啡',
          value: '9'
        },
        {
          label: '果汁或碳酸饮料',
          value: '10'
        }
      ],
      oilList: [
        {
          label: '大豆油',
          value: '1'
        },
        {
          label: '菜籽油',
          value: '2'
        },
        {
          label: '葵花籽油',
          value: '3'
        },
        {
          label: '橄榄油',
          value: '4'
        },
        {
          label: '花生油',
          value: '5'
        },
        {
          label: '动物油',
          value: '6'
        },
        {
          label: '调和油',
          value: '7'
        },
        {
          label: '茶籽油',
          value: '8'
        },
        {
          label: '其它',
          value: '9'
        }
      ]
    }
  },
  methods: {
    ...mapGetters(['orgCode']),
    handleChange(e) {
      console.log(e)
    },
    handleOk() {
      this.$refs.editform.validate(valid => {
        if (valid) {
          const params = {
            patientId: this.lifestyle.patientId,
            signinType: this.category.categoryType,
            suggestContent: this.category.suggestContent,
            orgCode: this.orgCode()
          }
          postAction('/201/02/2010219', params).then(res => {
            if (res.success) {
              this.$message.success(res.message)
              this.handleCancel()
            } else {
              this.$message.warning(res.message)
            }
          })
        }
      })
    },
    handleCancel() {
      this.saveVisit = false
    },
    save() {
      this.saveLoading = true
      const queryData = {
        cookingOil: this.lifestyle.cookingOil,
        cookingOilOthers: this.lifestyle.cookingOilOthers,
        dataId: this.lifestyle.dataId,
        drinkingWaterAmount: this.lifestyle.drinkingWaterAmount,
        drinkingWaterHabits: this.lifestyle.drinkingWaterHabits,
        drinkingWaterType: this.lifestyle.drinkingWaterType,
        drinksCans: this.lifestyle.drinksCans,
        eatBreakfast: this.lifestyle.eatBreakfast,
        eatCoarseGrainFood: this.lifestyle.eatCoarseGrainFood,
        eatDinner: this.lifestyle.eatDinner,
        eatEggs: this.lifestyle.eatEggs,
        eatExtraMeal: this.lifestyle.eatExtraMeal,
        eatFruits: this.lifestyle.eatFruits,
        eatLunch: this.lifestyle.eatLunch,
        eatMeat: this.lifestyle.eatMeat,
        eatMeatType: this.lifestyle.eatMeatType,
        eatMilk: this.lifestyle.eatMilk,
        eatNut: this.lifestyle.eatNut,
        eatSatisfied: this.lifestyle.eatSatisfied,
        eatSnacks: this.lifestyle.eatSnacks,
        eatStapleBreakfast: this.lifestyle.eatStapleBreakfast,
        eatStapleBreakfastDetail: this.lifestyle.eatStapleBreakfastDetail,
        eatStapleDinner: this.lifestyle.eatStapleDinner,
        eatStapleDinnerDetail: this.lifestyle.eatStapleDinnerDetail,
        eatStapleLunch: this.lifestyle.eatStapleLunch,
        eatStapleLunchDetail: this.lifestyle.eatStapleLunchDetail,
        eatVegetables: this.lifestyle.eatVegetables,
        eatingHabits: this.lifestyle.eatingHabits,
        eatingHabitsComment: this.lifestyle.eatingHabitsComment,
        eatingHabitsFood: this.lifestyle.eatingHabitsFood,
        eatingHabitsScore: this.lifestyle.eatingHabitsScore,
        eatingHabitsTimes: this.lifestyle.eatingHabitsTimes,
        healthProducts: this.lifestyle.healthProducts,
        healthProductsDetail: this.lifestyle.healthProductsDetail,
        isOil: this.lifestyle.isOil,
        isSalty: this.lifestyle.isSalty,
        likeDrink: this.lifestyle.likeDrink,
        likeEat: this.lifestyle.likeEat,
        likeMidnightfood: this.lifestyle.likeMidnightfood,
        likeSnacks: this.lifestyle.likeSnacks,
        patientId: this.lifestyle.patientId,
        stapleFoodStructure: this.lifestyle.stapleFoodStructure,
        stillBreakfast: this.lifestyle.stillBreakfast,
        teaDrinks: this.lifestyle.teaDrinks,
        teaDrinksDetail: this.lifestyle.teaDrinksDetail,
        tonicHerbs: this.lifestyle.tonicHerbs,
        tonicHerbsDetail: this.lifestyle.tonicHerbsDetail,
        whichMore: this.lifestyle.whichMore
      }
      postAction('/dossier/14/lifeway/eating/update', queryData)
        .then(res => {
          if (res.success) {
            this.$message.success('操作成功')
            this.$emit('next', '2')
          } else {
            this.$message.error('操作失败')
          }
        })
        .finally(_ => {
          this.saveLoading = false
        })
    },
    handleTemplateSave() {
      if (!this.lifestyle.eatingHabitsComment) {
        this.$message.warning('请填写小结')
        return
      }
      this.category.suggestContent = this.lifestyle.eatingHabitsComment
      this.saveVisit = true
    },
    modalFormOk(item) {
      this.lifestyle.eatingHabitsComment = item
    },
    handleTemplate() {
      this.$refs.modalForm.add()
    },
    confirm() {
      this.saveLoading = true
      this.$emit('confirm', this.confirmType)
      this.$emit('next', '2')
    }
  }
}
</script>

<style lang="less" scoped>
.container {
  position: relative;
  margin: 1rem;
  padding: 1rem;

  background-color: #fafafb;
  .stage {
    margin-bottom: 1rem;
    span {
      display: inline-block;
      width: 10rem;
      margin-right: 1rem;
    }
    p {
      display: inline-block;
      margin-left: 1rem;
      margin-right: 2rem;
      margin-bottom: 0;
    }
  }
  .ant-btn {
    position: absolute;
    right: 2rem;
    bottom: 2rem;
  }
  .ant-input {
    width: 200px;
    margin: 0 8px 8px 0;
  }
}
</style>

